package com.platform.usercenter.service.impl;

import java.util.List;
import com.platform.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.platform.usercenter.mapper.SysOrganizationRelationMapper;
import com.platform.usercenter.domain.SysOrganizationRelation;
import com.platform.usercenter.service.ISysOrganizationRelationService;

import javax.annotation.Resource;

/**
 * 组织上下游关系Service业务层处理
 *
 * @author platform
 * @date 2024-10-24
 */
@Service
public class SysOrganizationRelationServiceImpl implements ISysOrganizationRelationService
{
    @Resource
    private SysOrganizationRelationMapper sysOrganizationRelationMapper;

    /**
     * 查询组织上下游关系
     *
     * @param id 组织上下游关系主键
     * @return 组织上下游关系
     */
    @Override
    public SysOrganizationRelation selectSysOrganizationRelationById(Long id)
    {
        return sysOrganizationRelationMapper.selectSysOrganizationRelationById(id);
    }

    /**
     * 查询组织上下游关系列表
     *
     * @param sysOrganizationRelation 组织上下游关系
     * @return 组织上下游关系
     */
    @Override
    public List<SysOrganizationRelation> selectSysOrganizationRelationList(SysOrganizationRelation sysOrganizationRelation)
    {
        return sysOrganizationRelationMapper.selectSysOrganizationRelationList(sysOrganizationRelation);
    }

    /**
     * 新增组织上下游关系
     *
     * @param sysOrganizationRelation 组织上下游关系
     * @return 结果
     */
    @Override
    public int insertSysOrganizationRelation(SysOrganizationRelation sysOrganizationRelation)
    {
        sysOrganizationRelation.setCreateTime(DateUtils.getNowDate());
        return sysOrganizationRelationMapper.insertSysOrganizationRelation(sysOrganizationRelation);
    }

    /**
     * 修改组织上下游关系
     *
     * @param sysOrganizationRelation 组织上下游关系
     * @return 结果
     */
    @Override
    public int updateSysOrganizationRelation(SysOrganizationRelation sysOrganizationRelation)
    {
        sysOrganizationRelation.setUpdateTime(DateUtils.getNowDate());
        return sysOrganizationRelationMapper.updateSysOrganizationRelation(sysOrganizationRelation);
    }

    /**
     * 批量删除组织上下游关系
     *
     * @param ids 需要删除的组织上下游关系主键
     * @return 结果
     */
    @Override
    public int deleteSysOrganizationRelationByIds(Long[] ids)
    {
        return sysOrganizationRelationMapper.deleteSysOrganizationRelationByIds(ids);
    }

    /**
     * 删除组织上下游关系信息
     *
     * @param id 组织上下游关系主键
     * @return 结果
     */
    @Override
    public int deleteSysOrganizationRelationById(Long id)
    {
        return sysOrganizationRelationMapper.deleteSysOrganizationRelationById(id);
    }
}
